import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';

import '../viewmodel/set_url_view_model.dart';

class SetUrlPage extends BaseStatefulMvvmWidget{
  final String address;

  SetUrlPage(this.address);

  @override
  State<StatefulWidget> createState() =>_SetUrlState();

}

class _SetUrlState extends BaseMvvmState<SetUrlViewModel,SetUrlPage>{
  @override
  Widget buildLoadingContentView() {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        CommonText('点击确定，配置消费机地址为当前连接服务'),
        Container(height: 10,),
        ElevatedButton(onPressed: (){
          viewModel.sendData();
        }, child: CommonText('确定'))
      ],
    );
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      appBar: CommonAppBar('配置'),
      body: loadingContentWidget,
    );
  }

  @override
  SetUrlViewModel createViewModel() {
    return SetUrlViewModel(context,widget.address);
  }

  @override
  void onRetryClick() {
    // TODO: implement onRetryClick
  }

}